import request from '@/utils/request'

// 查询方案统计数据
export const getInvtPlanStatistics = (params) => {
  return request({
    url: '/v1/departmentWork/investment/statistics/',
    method: 'get',
    params
  })
}

// 查询统计的图形配置
export const getInvtPlanStChart = (params) => {
  return request({
    url: '/v1/departmentWork/investment/statisticsChart/',
    method: 'get',
    params
  })
}

export const publishInvestmentPlan = (data) => {
  return request({
    url: '/v1/departmentWork/investment/',
    method: 'post',
    data
  })
}

// 获取列表
export const getInvestomentPlan = (params) => {
  return request({
    url: '/v1/departmentWork/investment/',
    method: 'get',
    params
  })
}

export const getMyInvestment = (params) => {
  return request({
    url: '/v1/departmentWork/investment/my/',
    method: 'get',
    params
  })
}

export const getExamineInvestment = (params) => {
  return request({
    url: '/v1/departmentWork/investment/examine/',
    method: 'get',
    params
  })
}

// 保存方案的记录
export const saveInvestmentFollow = (data, params) => {
  return request({
    url: '/v1/departmentWork/investment/my/investmentRecord/',
    method: 'post',
    params,
    data
  })
}
export const getInvestmentFollow = (params) => {
  return request({
    url: '/v1/departmentWork/investment/my/investmentRecord/',
    method: 'get',
    params,
  })
}

// 修改方案记录、审批和结果等
export const putInvestPlan = (data, planId) => {
  return request({
    url: `/v1/departmentWork/investment/examine/${planId}/`,
    method: 'put',
    data,
  })
}

// 审查方案
export const auditInvestPlan = (data) => {
  return request({
    url: '/v1/departmentWork/investment/audit/',
    method: 'put',
    data,
  })
}

// 按月份查询方案的数量和运行中的数量
export const SInvestmentMonthly = async (params) => {
  return request({
    url: '/v1/departmentWork/investment/statisticsMonthly/',
    method: 'get',
    params,
  })
}

// 删除个人方案记录
export const deleteMyInvestPlan = (params) => {
  return request({
    url: '/v1/departmentWork/investment/my/',
    method: 'delete',
    params,
  })
}
